package Games.PumpGame 
{
	import flash.events.Event;
	import flash.events.KeyboardEvent;
	import Framework.BaseEventHandler;
	import Framework.BaseGame;
	import Framework.KeyEvents.KeyEvent;
	import Framework.KeyList;
	import flash.events.EventDispatcher;
	import Games.PumpGame.Gui.AvatarVisual;
	
	/**
	 * ...
	 * @author Menno
	 */
	public class EventHandler extends BaseEventHandler
	{
		//private static var _dispatcher:EventDispatcher;
		
		public function EventHandler(game:BaseGame) 
		{
			addUpdateListener();
			super(game);
		}
		
		protected function addUpdateListener():void
		{
			
		}
		
		override protected function downKey(e:KeyboardEvent):void 
		{
			switch(e.keyCode)
			{
				case KeyList.ARROW_DOWN:
					dispatcher.dispatchEvent(new KeyEvent(KeyEvent.ARROW_DOWN));
					break;
				case KeyList.ARROW_UP:
					dispatcher.dispatchEvent(new KeyEvent(KeyEvent.ARROW_UP));
					break;
				case KeyList.ARROW_LEFT:
					dispatcher.dispatchEvent(new KeyEvent(KeyEvent.ARROW_LEFT));
					break;
				case KeyList.ARROW_RIGHT:
					dispatcher.dispatchEvent(new KeyEvent(KeyEvent.ARROW_RIGHT));
					break;
				case KeyList.SPACE:
					dispatcher.dispatchEvent(new KeyEvent(KeyEvent.SPACE));
					break;
			}
		}
		
		override protected function upKey(e:KeyboardEvent):void 
		{

		}
		
		public function updateCycle():void
		{
			
		}
		
		static public function get myDispatcher():EventDispatcher 
		{
			return dispatcher
		}
		
	}
	
}